package com.poker.controller;

import com.poker.base.Result;
import com.poker.entity.SeatedUser;
import com.poker.service.PlayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Properties;

@Api(value = "游戏模块",tags = "游戏模块")
@RestController
@CrossOrigin
public class PlayController {

    @Autowired
    private PlayService playService;

    @ApiOperation(value = "选座")
    @GetMapping("/selectSeat")
    public Result<Integer> getUser(@RequestParam String seatNum) throws IOException {
        //该方法返回当前已落座的用户的个数
        return playService.selectSeat(seatNum);
    }

    @ApiOperation(value = "查询已就座的情况")
    @GetMapping("/querySeated")
    public Result<List<SeatedUser>> querySeated(){
        return playService.querySeated();
    }

    @ApiOperation(value = "查询可选的对家（会查出来两个结果）")
    @GetMapping("/querySides")
    public Result<List<SeatedUser>> querySides(){
        return playService.querySides();
    }

    @ApiOperation(value = "查询可选的记分员（会查出来两个结果）")
    @GetMapping("/queryRecorders")
    public Result<List<SeatedUser>> queryRecorders(@RequestParam String userIds){
        System.out.println("userIds"+userIds);
        return playService.queryRecorders(userIds);
    }


}
